define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'chat/index',
        add_url: 'chat/add',
        edit_url: 'chat/edit',
        delete_url: 'chat/delete',
        export_url: 'chat/export',
        modify_url: 'chat/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh','delete','export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'ID',search: false},
                    {field: 'atob', title: '聊天',search: false},
                    //{field: 'fid', title: '发送人'},
                    //{field: 'userid', title: '接收人'},
                    {field: 'merge', title: '聊天标识'},
                    //{field: 'rank', title: '用户等级',search: false},
                    {field: 'type', title: '类型',selectList: {99: '<a style="color:#16b777">系统</a>',0:'文本',1:'<a style="color:#ff5722">图片</a>'}},
                    {field: 'content', title: '文本',search: false,width:"50%"},
                    {field: 'time', title: '时间',search: false,templet:'<div><a>{{dateFormat(d.time)}}</a></div>'},
                    //{field: 'yidu', title: '是否已读,默认0'},
                    {
                        
                        title: '操作',
                        templet: ea.table.tool,
                        operat: ['delete']
                    },
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});